
import React, { ReactNode } from "react"
import { NodeViewContext } from "./NodeViewContext";

export interface ViewBox {
    ax: number,
    ay: number,
    bx: number,
    by: number
}

interface _Prop {
    width: number,
    height: number,
    children: ReactNode;
}

export default function (props: _Prop) {
    return (
        <>
            <svg xmlns="http://www.w3.org/2000/svg"
                 height={props.height} width={props.width}
                 viewBox={'0 0 ' + props.height + ' ' + props.width}>
                <NodeViewContext.Provider value={{
                    height: props.height, 
                    width: props.width, 
                    relX: 0,
                    relY: 0,
                }}>
                    <rect x={0} y={0} height={props.height} width={props.width} 
                          rx={5} ry={5} fill="transparent" stroke="gray"></rect>
                    {props.children}
                </NodeViewContext.Provider>
            </svg>
        </>
    )
}
